//
//  ZHConsultMainViewController.m
//  Doctor
//
//  Created by liuzhishan on 16/1/18.
//  Copyright © 2016年 shanshan. All rights reserved.
//

#import "ZHConsultMainViewController.h"
#import "ZHConsultMessageViewController.h"
#import "ZHConsultPastCaseViewController.h"
#import "ZHConsultPrivilegeViewController.h"
#import "ZHConsultProjectViewController.h"


@interface ZHConsultMainViewController ()

@property (nonatomic,strong) NSArray *titleArray;
@property (nonatomic,strong) NSArray *imageNormalArray;
@property (nonatomic,strong) NSArray *imageHighArray;

@property (nonatomic,strong) UIScrollView *scrollView;


@end

@implementation ZHConsultMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    [self addMyChildController];
    [self addMyScrollView];

}



-(void)addMyScrollView
{
    self.scrollView = [[UIScrollView alloc]init];
    
    self.scrollView.frame = self.view.bounds;
    
    [self.view addSubview:self.scrollView];
    
    self.scrollView.contentSize = CGSizeMake(WIDTH * 4, HEIGHT);
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


+(void)initialize
{
    
    UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];
    NSMutableDictionary * dict = [NSMutableDictionary dictionary];
    
    
    dict[NSForegroundColorAttributeName] = TABBARTEXTCOLOR;
    [item setTitleTextAttributes:dict forState:UIControlStateSelected];
    
    
    UINavigationBar *bar = [UINavigationBar appearanceWhenContainedIn:self, nil];
    [bar setTitleTextAttributes:dict];
    
}




-(void)addMyChildController
{
    ZHConsultMessageViewController *news = [[ZHConsultMessageViewController alloc]init];
    
    
    [self setUIViewController:news andTitle:@"微信" andImageName:@"tabbar_mainframe" andHeightImageName:@"tabbar_mainframeHL"];
    
    
    ZHConsultPastCaseViewController *read = [[ZHConsultPastCaseViewController alloc]init];
    
    [self  setUIViewController:read andTitle:@"通讯录" andImageName:@"tabbar_contacts" andHeightImageName:@"tabbar_contactsHL"];
    
    
    
    ZHConsultPrivilegeViewController *listen = [[ZHConsultPrivilegeViewController alloc]init];
    
    [ self  setUIViewController:listen andTitle:@"发现" andImageName:@"tabbar_discover" andHeightImageName:@"tabbar_discoverHL"];
    
    
    ZHConsultProjectViewController *me = [[ZHConsultProjectViewController alloc]init];
    
    [ self  setUIViewController:me andTitle:@"我" andImageName:@"tabbar_me" andHeightImageName:@"tabbar_meHL"];
    
    
//    [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor]} forState:UIControlStateNormal];
//    [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor redColor]} forState:UIControlStateSelected];

    
    
    
}

-(void)setUIViewController:(UIViewController*)current andTitle:(NSString*)title andImageName:(NSString *)imageName  andHeightImageName:(NSString *)heightImageName
{
    
    current.tabBarItem.title = title;
    current.tabBarItem.image = [UIImage getoraiginalImageWithName:imageName];
    
    current.tabBarItem.selectedImage = [UIImage getoraiginalImageWithName:heightImageName];
    UINavigationController *navi = [[UINavigationController alloc]initWithRootViewController:current];
    navi.navigationBar.translucent = NO;
    
    [self addChildViewController:navi];
    
    
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
